#include<cstdio>
const int MAXINT = 2100000000;
int a[501][101],f[501][101],p[501][101],n,m,pa[100011];
int min(int x,int y)
{
    return x<y?x:y;
}
int main()
{
    freopen("test.in","r",stdin);
    //freopen("test.out","w",stdout);
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
      for(int j=1;j<=m;j++)
        scanf("%d",&a[i][j]);
    for(int i=1;i<=m;i++)
            f[1][i]=a[1][i];
    for(int i=2;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
           f[i][j]=f[i-1][j]+a[i][j];
           p[i][j]=j;
        }
		for(int j=2;j<=m;j++)
           if(f[i][j]>f[i][j-1]+a[i][j])
           {
               f[i][j]=f[i][j-1]+a[i][j];                   
               p[i][j]=j-1;
           }       
        for(int j=m-1;j>=1;j--)
           if(f[i][j]>f[i][j+1]+a[i][j])
           {
              f[i][j]=f[i][j+1]+a[i][j];
              p[i][j]=j+1;
           }
                                                                
    }
    int ans=MAXINT, t;
    for(int i=1;i<=m;i++)
       if(f[n][i]<ans){ans=f[n][i];t=i;}
    int i=n,j=t,count=0;
    do
	{
		count++;
        pa[count]=j;
        if(j==p[i][j])i--;
        else j=p[i][j];
    }while(i>=1&&j!=0);
   // pa[count]=j;
    //t=1;
    //if(n>1)while(pa[t]!=pa[t+1])t++;
    for(int i=count;i>=1;i--)
        printf("%d\n",pa[i]);
  //  printf("%d\n",pa[t]);
    return 0;
}
           
